package io.github.codelifeleno.jdbrelease.config;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

/**
 * 注释配置
 */
public class Comments {
    /**
     * 单行注释的配置
     */
    private SingleLine singleLine = new SingleLine();
    /**
     * 多行注释的配置
     */
    private List<Block> blocks = new ArrayList<>();

    @Override
    public String toString() {
        return new StringJoiner(", ", Comments.class.getSimpleName() + "[", "]")
                .add("singleLine=" + singleLine)
                .add("blocks=" + blocks)
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;

        Comments comments = (Comments) o;
        return Objects.equals(getSingleLine(), comments.getSingleLine()) && Objects.equals(getBlocks(), comments.getBlocks());
    }

    @Override
    public int hashCode() {
        int result = Objects.hashCode(getSingleLine());
        result = 31 * result + Objects.hashCode(getBlocks());
        return result;
    }

    public SingleLine getSingleLine() {
        return singleLine;
    }

    public void setSingleLine(SingleLine singleLine) {
        this.singleLine = singleLine;
    }

    public List<Block> getBlocks() {
        return blocks;
    }

    public void setBlocks(List<Block> blocks) {
        this.blocks = blocks;
    }

    public Comments() {
    }

    public Comments(SingleLine singleLine, List<Block> blocks) {
        this.singleLine = singleLine;
        this.blocks = blocks;
    }
}
